#include<vector>
#include<iostream>
using std::vector;

class Solution {
public:
    vector<int> productExceptSelf(vector<int>& nums) {
        vector<int> results = vector<int>(nums.size(), 1);
        int before = nums[0];
        for (int i = 1; i < nums.size(); i++) {
            results[i] *= before;
            before *= nums[i];
        }
        int after = nums.back();
        for (int i = nums.size()-2; i >= 0; i--) {
            results[i] *= after;
            after *= nums[i];
        }
        return results;
    }
};

int main() {
    int tmp;
    vector<int> input;
    while (std::cin >> tmp) {
        input.push_back(tmp);
    }
    for (auto n: input) {
        std::cout << n << " ";
    }
    std::cout << "\nResult is :\n";
    auto res = Solution().productExceptSelf(input);
    for (auto n: res) {
        std::cout << n << " ";
    }
    std::cout << "\n";
    return 0;
}